Practical notes on implementing derivatives
نویسنده
چکیده
For many applications in graphics, one is confronted with the task of solving an optimization problem or solving a nonlinear system of equations. Efficient methods for solving these problems require derivatives to be available. Differentiation in numerical methods also occurs for many other reasons, such as computing forces from potential energy or computing normal and curvature information from an analytic level set. For most authors in the graphics community, the process of working out, implementing, and testing derivative routines does not seem to cause real difficulties. This is not always true, however, and some papers punt on the task in a variety of ways. One common way of avoiding the task of computing derivatives by hand is to rely on autodifferentiation. Autodifferentiation is a very reasonable and effective solution in some circumstances, which has received a fair amount of attention. This approach can be quite effective for rapid prototyping or for circumstances where computing derivatives does not take a significant fraction of the total runtime. I use autodifferentiation myself for a variety of purposes. There are many contexts in which autodifferentiation may fail to be adequate, such as being too slow or not sufficiently numerically robust. Autodifferentiation also does not work well in some circumstances, such as differentiating quantities depending on a singular value decomposition, a problem that occurs when working with constitutive models. In these cases, it is best to perform the differentiation by hand. Instead of doing this, some authors avoid the derivatives by using BFGS or L-BFGS instead of Newton’s method. Others approximate the derivatives, such as by omitting terms. Other authors choose to compute derivatives using Maple, Mathematica, or other similar software. These practices are all generally bad. BFGS and L-BFGS do not converge as rapidly as Newton’s method, especially for large sparse systems. Nor do numerical methods perform as well when derivatives are approximated. Derivatives computed symbolically using a software package tend to have many problems, including being enormously complicated, difficult to maintain, not numerically robust, and inefficient. In this document, I explore practical strategies for implementing derivatives in code. I focus our attention on strategies that are effective even when the derivatives appear hopelessly difficult to work out and implement. As such, many of the suggestions that I make are overkill for simple tasks.
منابع مشابه
Designing and Implementing a Practical Course of "Pharmacotherapy in Special Populations" for Medical Interns
Introduction: Learning how to use medications rationally is an important and key issue in medical education. The aims of this study were needs assessment, designing and implementing practical training on pharmacotherapeutic issues in special populations (pregnant women, nursing mothers who are breast-feeding, infants, and elders) for medical interns. Methods: This study was conducted in two con...
متن کاملAlice in the Land of Oz - An Interoperability-based Implementation of a Functional Language on Top of a Relational Language
This paper reports practical experience in implementing Alice, an extension of Standard ML, on top of an existing implementation of Oz. This approach yields a high-quality implementation with little effort. The combination is an advanced programming system for both Oz and Alice, which offers more than either language on its own.
متن کاملImplementing a Domain-Specific Language Using Stratego/XT: An Experience Paper
We describe the experience of implementing a Domain-Specific Language using transformation to a General Purpose Language. The domain of application is image processing and low-level computer vision. The transformation is accomplished using the Stratego/XT language transformation toolset. The implementation presented here is contrasted with the original implementation carried out many years ago ...
متن کاملVoluntary use of online lecture notes: correlates of note use and note use as an alternative to class attendance
Note taking and note reviewing are essential college student learning activities. A large number of carefully controlled studies have evaluated student effectiveness in implementing each of these skills and have found that both can be improved by providing instructor notes.While the Internet now offers a practical method for providing notes, some instructors are reluctant to offer notes because...
متن کاملA Finite Algorithm for the Exact Evaluation of Higher Order Partial Derivatives of Functions of Many Variables
In recent work [3,4] on the development of a complete differential system for the local and nonlocal sensitivity analysis of parameterized systems, it quickly became apparent that recourse had to be made to an automatic method of evaluating needed partial derivatives if a practical numerical tool was to be obtained. For example, the local parameter sensitivity analysis of an n-equation system o...
متن کامل